package top.cflwork.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

import top.cflwork.dao.ShopCommentDao;
import top.cflwork.vo.ShopCommentVo;
import top.cflwork.service.ShopCommentService;
import top.cflwork.common.SequenceId;


@Service
public class ShopCommentServiceImpl implements ShopCommentService {
	@Autowired
	private ShopCommentDao shopCommentDao;
    @Autowired
    private SequenceId sequenceId;
	@Override
    @Transactional
	public ShopCommentVo get(String id){
		return shopCommentDao.get(id);
	}
	
	@Override
    @Transactional
	public List<ShopCommentVo> list(ShopCommentVo shopCommentVo){
		return shopCommentDao.list(shopCommentVo);
	}
	
	@Override
    @Transactional
	public long count(ShopCommentVo shopCommentVo){
		return shopCommentDao.count(shopCommentVo);
	}
	
	@Override
    @Transactional
	public int save(ShopCommentVo shopComment){
	    shopComment.setId(sequenceId.nextId());
	    return shopCommentDao.save(shopComment);
	}
	
	@Override
    @Transactional
	public int update(ShopCommentVo shopComment){
		return shopCommentDao.update(shopComment);
	}
	
	@Override
    @Transactional
	public int remove(String id){
		return shopCommentDao.remove(id);
	}
	
	@Override
    @Transactional
	public int batchRemove(String[] ids){
		return shopCommentDao.batchRemove(ids);
	}

    @Override
    @Transactional
    public int batchSave(List<ShopCommentVo> shopCommentList){
			shopCommentList.forEach(e -> e.setId(sequenceId.nextId()));
        return shopCommentDao.batchSave(shopCommentList);
    }
}
